<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/templateList.xhtml">

	<ui:define name="body">
		
		<h2 class="title"><a href="#">Gerenciar Perfis</a></h2><br/>
		
			<h:form id="listPerfisForm">
		        <rich:dataTable value="#{manterPerfilController.listaPerfis}" var="_perfil"
		        	rows="10"
		        	id="tabelaPerfis">
		        
		        	<rich:column>
		        		<f:facet name="header">
		        			<h:selectBooleanCheckbox value="#{manterPerfilController.selecionadoTodos}">
		        				<a:support event="onchange" action="#{manterPerfilController.selecionaTodos}"
		        					reRender="tabelaPerfis"/>
		        			</h:selectBooleanCheckbox>	
		        		</f:facet>
		        		<h:selectBooleanCheckbox value="#{_perfil.selecionado}"/>
		        	</rich:column>
		        	
		        	<rich:column filterBy="#{_perfil.dscNome}" filterEvent="onkeyup">
		        		<f:facet name="header">Nome</f:facet>
		        		<h:outputText value="#{_perfil.dscNome}"/>
		        		<a:queue ignoreDupResponses="true"/>
		        	</rich:column>
		        	
		        	<rich:column rendered="#{identity.hasRole('GERENCIAR_PERFIS_GRAVAR')}">
		        		<f:facet name="header"></f:facet>
		        		<h:commandLink value="EDITAR"
		        			action="#{manterPerfilController.editar(_perfil)}"/>
		        	</rich:column>
		        </rich:dataTable>
		        <rich:datascroller for="tabelaPerfis" renderIfSinglePage="false"/>
		        
		        <br/>
	            <div class="actionButtons">
		        	<h:commandButton id="remove" value="Excluir" action="#{manterPerfilController.excluir}"
		        		rendered="#{identity.hasRole('GERENCIAR_PERFIS_EXCLUIR')}"
		        		onclick="javascript:if(!confirm('Tem certeza que deseja excluir?'))return false;"/>
		        	<h:commandButton id="new" value="Novo" action="#{manterPerfilController.novo()}"
		        		rendered="#{identity.hasRole('GERENCIAR_PERFIS_GRAVAR')}"/>
		        </div>
	        </h:form>
 </ui:define>
</ui:composition>
